<?php
require_once 'pages/TMSListPage.inc';
require_once 'models/TMSTypesModel.inc';

class TMSAdminGlossaryPage extends TMSListPage {
	
/**
 * @var TMSTypesModel
 */	
	protected $_ioc_types_model_;
	
	private $_type_;
	
	public function Handle(THttpRequest $request){
		if ($request->class){
			$this->Model->Classname = $request->class;
			if ($this->TypesModel){
				if ($type = $this->TypesModel->GetItem($request->class))
					$this->title = $type->Name;
			}
			$cp = $this->Model->ClassProperties();
			foreach ($cp as $nm=>$value){
				$this->SortBy = array($nm=>"ASC");
				break;
			}
		}
		parent::Handle($request);
	}	

	protected function processUrlParameters(array $parameters){
		if (!isset($parameters['class']) && ($this->request instanceof THttpRequest))
			$parameters['class'] = $this->request->class;
		return parent::processUrlParameters($parameters);
	}	
}